package org.come.Jpanel;

import com.tool.btn.GoodPanelBtn;
import com.tool.btn.RefineOperBtn;
import com.tool.btn.goodbtn;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;
import org.come.entity.Goodstable;
import org.come.mouslisten.RefinersMouslisten;
import org.come.mouslisten.WLLMouslisten;
import org.come.until.CutButtonImage;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.RefiningUtil;
import org.come.until.Util;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;

 

public class RefiningEquiJpanel extends JPanel {

    public BigDecimal money = new BigDecimal(1000000);// 消耗金钱
    private RefineOperBtn workshopBtn;// 炼化装备按钮
    private RefineOperBtn workshopBtn100;// 炼化装备按钮
    private GoodPanelBtn clearAll; //当前整理背包
    // private JLabel labZfz,// 作坊主
    // labDw,// 段位
    // labDj,// 等级
    // labKsc,// 可生产
    // labSld,// 熟练度
    // labCj;// 成就
    public Goodstable[] goods = new Goodstable[6];
    private JLabel[] labGoods = new JLabel[6];

    public JLabel[] GoodsListLabel = new JLabel[24]; // 用来存放24个物品表格
    // 放置6个背包切换按钮
    private goodbtn[] btnrights;

    // private JComboBox<String> comboBox;
    public RefiningEquiJpanel() {
        if("水墨UI".equals(MyIsif.getStyle())) {
            this.setPreferredSize(new Dimension(558, 516));
            this.setLayout(null);
            this.setOpaque(false);

            // 炼化装备按钮
            workshopBtn = new RefineOperBtn("skin/8100226/newbutton/B21.png",  1, UIUtils.COLOR_BLACK, UIUtils.TEXT_FONT, this, 0,
                    "?");
            workshopBtn.setBounds(441, 125, 79, 24);
            this.add(workshopBtn);
            // 放置炼化装备以及炼化材料
            for (int i = 0; i < 6; i++) {
                int row = i % 3;
                int col = i / 3;
                labGoods[i] = new JLabel();
                labGoods[i].addMouseListener(new RefinersMouslisten(this, 24 + i));
                labGoods[i].setBounds(250 + row * 67, 79 + col * 65, 54, 51);
                this.add(labGoods[i]);
            }

            // Font font = new Font("宋体", 0, 14);
            // Color color = new Color(187, 165, 75);
            // // 作坊主
            // labZfz = new JLabel();
            // labZfz.setBounds(88, 312, 96, 14);
            // labZfz.setForeground(color);
            // labZfz.setFont(font);
            // this.add(labZfz);
            // // 段位
            // labDw = new JLabel();
            // labDw.setBounds(88, 344, 96, 14);
            // labDw.setForeground(color);
            // labDw.setFont(font);
            // this.add(labDw);
            // // 等级
            // labDj = new JLabel();
            // labDj.setBounds(88, 376, 96, 14);
            // labDj.setForeground(color);
            // labDj.setFont(font);
            // this.add(labDj);
            // // 可生产
            // labKsc = new JLabel();
            // labKsc.setBounds(88, 408, 96, 14);
            // labKsc.setForeground(color);
            // labKsc.setFont(font);
            // this.add(labKsc);
            // // 熟练度
            // labSld = new JLabel();
            // labSld.setBounds(88, 440, 96, 14);
            // labSld.setForeground(color);
            // labSld.setFont(font);
            // this.add(labSld);
            // // 成就
            // labCj = new JLabel();
            // labCj.setBounds(88, 472, 96, 14);
            // labCj.setForeground(color);
            // labCj.setFont(font);
            // this.add(labCj);

            // comboBox=new JComboBox<String>();
            // comboBox.addItem("炼化装备");
            // comboBox.addItem("炼化仙器");
            // comboBox.addItem("炼化神兵");
            // comboBox.setBounds(345, 72, 141, 20);
            // this.add(comboBox);
            // 存放物品的表格1~24
            for (int i = 0; i < 24; i++) {
                int row = i % 6;
                int col = i / 6;
                GoodsListLabel[i] = new JLabel();
                GoodsListLabel[i].addMouseListener(new RefinersMouslisten(this, i));
                GoodsListLabel[i].setBounds(218 + row * 51, 277 + col * 51, 49, 49);
                this.add(GoodsListLabel[i]);
            }
            // 背包四个页数的按钮
            btnrights = new goodbtn[6];
            for (int i = 0; i < btnrights.length; i++) {
                btnrights[i] = new goodbtn("skin/8100226/newbutton/C0"+(i+1)+".png", 0, this, i);
                btnrights[i].setBounds(524, 284 + i * 35, 35, 31);
                this.add(btnrights[i]);
            }

            this.labGoodstxt = new JLabel[6];//这两行添加作坊炼化提示显示，这个只是水墨界面--------小情调备注
            this.redis();
        }else{
            this.setPreferredSize(new Dimension(536, 481));
            this.setLayout(null);
            this.setOpaque(false);

            //当前整理背包
            clearAll = new GoodPanelBtn("inkImg/hongmu/1/a3.png", 1, "整");
            clearAll.addMouseListener(new WLLMouslisten(17));
            clearAll.setBounds(188-20, 205+85, 17, 17);
            this.add(clearAll);

            // 炼化装备按钮
            workshopBtn = new RefineOperBtn("inkImg/hongmu/1/w50.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY16, this, 0,
                    "?");
            workshopBtn.setBounds(421, 125, 59, 26);
            this.add(workshopBtn);

            for (int i = 0; i < 6; i++) {
                int row = i % 3;
                int col = i / 3;
                labGoods[i] = new JLabel();
                labGoods[i].addMouseListener(new RefinersMouslisten(this, 24 + i));
                labGoods[i].setBounds(226 + row * 67, 99 + col * 65, 54, 51);
                this.add(labGoods[i]);
            }

            for (int i = 0; i < 24; i++) {
                int row = i % 6;
                int col = i / 6;
                GoodsListLabel[i] = new JLabel();
                GoodsListLabel[i].addMouseListener(new RefinersMouslisten(this, i));
                GoodsListLabel[i].setBounds(193 + row * 51, 298 + col * 51, 49, 49);
                this.add(GoodsListLabel[i]);
            }
            // 背包六个页数的按钮
            btnrights = new goodbtn[6];
            for (int i = 0; i < btnrights.length; i++) {
                btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);
                if (i == 1) {
                    this.btnrights[i].setBounds(81+161, 442+60 , 50, 24);//包裹2
                } else if (i == 2) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹3
                    this.btnrights[i].setBounds(132+160,  442+52 , 50, 40);
                } else if (i == 3) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹4
                    this.btnrights[i].setBounds(183+160, 442+60 , 50, 24);
                }  else if (i == 4) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹5
                    this.btnrights[i].setBounds(183+210, 442+60, 50, 24);
                } else if (i == 5) {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹6
                    this.btnrights[i].setBounds(234+210, 442+60, 50, 24);
                }else {
                    btnrights[i] = new goodbtn("inkImg/hongmu/1/50x51.png", 0, this, i);//包裹1
                    this.btnrights[i].setBounds(28+162, 442+51, 50, 40);
                }
                this.add(this.btnrights[i]);
            }
            this.labGoodstxt = new JLabel[6];//这两行添加作坊炼化提示显示，这个只是水墨界面--------小情调备注
            this.redis2();
        }
    }
    private JLabel[] labGoodstxt;
    /** 添加注解 */
    public void redis(){

        
        
        
        Font font = new Font("宋体", Font.PLAIN, 15);
        Color color = new Color(239, 238, 12);
        // 巫铸
        JLabel labZbwz = new JLabel("装备巫铸");
        labZbwz.setBounds(55, 112, 141, 20);
        labZbwz.setForeground(color);
        labZbwz.setFont(font);
        this.add(labZbwz);
        JLabel labZbdz = new JLabel("装备打造");
        labZbdz.setBounds(55, 92, 141, 20);
        labZbdz.setForeground(color);
        labZbdz.setFont(font);
        this.add(labZbdz);
        JLabel labZblh = new JLabel("装备炼化");
        labZblh.setBounds(55, 72, 141, 20);
        labZblh.setForeground(color);
        labZblh.setFont(font);
        this.add(labZblh);
        JLabel labLhsb = new JLabel("炼化神兵");
        labLhsb.setBounds(55, 132, 141, 20);
        labLhsb.setForeground(color);
        labLhsb.setFont(font);
        this.add(labLhsb);
        JLabel labLhxq = new JLabel("炼化仙器");
        labLhxq.setBounds(55, 152, 141, 20);
        labLhxq.setForeground(color);
        labLhxq.setFont(font);
        this.add(labLhxq);
        JLabel labzxcz = new JLabel("造型重铸");
        labzxcz.setBounds(55, 172, 141, 20);
        labzxcz.setForeground(color);
        labzxcz.setFont(font);
        this.add(labzxcz);

        JLabel lahbsj = new JLabel("伙伴装备升级");
        lahbsj.setBounds(55, 192, 141, 20);
        lahbsj.setForeground(color);
        lahbsj.setFont(font);
        this.add(lahbsj);

        JLabel lahbcz = new JLabel("伙伴装备重铸");
        lahbcz.setBounds(55, 212, 141, 20);
        lahbcz.setForeground(color);
        lahbcz.setFont(font);
        this.add(lahbcz);

        JLabel lahbpy = new JLabel("伙伴装备培养");
        lahbpy.setBounds(55, 232, 141, 20);
        lahbpy.setForeground(color);
        lahbpy.setFont(font);
        this.add(lahbpy);
        labZbwz.addMouseListener(new MouseAdapter(){

            @Override
            public void mousePressed(final MouseEvent e){
                labZbwz.setOpaque(true);
                labZbwz.setBackground(new Color(33, 42, 52));
                labZbdz.setOpaque(false);
                labZbdz.setBackground(null);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);

                RefiningEquiJpanel.this.labGoodstxt[0].setText("高级装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("对应矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("血玲珑");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("<html><body><p align= center >巫铸</p><p align= center >材料</p><p align= center >数量</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
            }*/
        });

        labZbdz.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labZbdz.setOpaque(true);
                labZbdz.setBackground(new Color(33, 42, 52));
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("对应矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });
        labZblh.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labZblh.setOpaque(true);
                labZblh.setBackground(new Color(33, 42, 52));
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("<html><body><p align= center >内丹</p><p align= center >&nbsp;</p><p align= center >精华</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("血玲珑");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("<html><body><p align= center >九彩</p><p align= center >云龙</p><p align= center >珠</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("<html><body><p align= center >九彩</p><p align= center >云龙</p><p align= center >珠</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("<html><body><p align= center >九彩</p><p align= center >云龙</p><p align= center >珠</p></body></html>");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });
        labLhsb.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhsb.setOpaque(true);
                labLhsb.setBackground(new Color(33, 42, 52));
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("神兵");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("神兵石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });
        labLhxq.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setOpaque(true);
                labLhxq.setBackground(new Color(33, 42, 52));
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("仙器");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("仙器精华");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        labzxcz.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setOpaque(true);
                labzxcz.setBackground(new Color(33, 42, 52));
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("仙器");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("重铸石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        lahbsj.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setOpaque(true);
                lahbsj.setBackground(new Color(33, 42, 52));
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        lahbcz.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setOpaque(true);
                lahbcz.setBackground(new Color(33, 42, 52));
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        lahbpy.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setOpaque(true);
                lahbpy.setBackground(new Color(33, 42, 52));
                RefiningEquiJpanel.this.labGoodstxt[0].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });
       int i = 0;
        while (i < 6) {
            final int row = i % 3;
            final int col = i / 3;
            (this.labGoodstxt[i] = new JLabel("", 0)).setBounds(246 + row * 67, 76 + col * 65, 54, 51);
            this.labGoodstxt[i].setForeground(new Color(102, 102, 102));
            this.labGoodstxt[i].setFont(new Font("宋体", 0, 13));
            this.add((Component)this.labGoodstxt[i]);
            ++i;
        }

    }
    public void redis2(){




        Font font = new Font("宋体", Font.PLAIN, 15);
        Color color = new Color(239, 238, 12);
        // 巫铸
        JLabel labZbwz = new JLabel("装备巫铸");
        labZbwz.setBounds(29, 125, 141, 20);
        labZbwz.setForeground(color);
        labZbwz.setFont(font);
        this.add(labZbwz);
        JLabel labZbdz = new JLabel("装备打造");
        labZbdz.setBounds(29, 105, 141, 20);
        labZbdz.setForeground(color);
        labZbdz.setFont(font);
        this.add(labZbdz);
        JLabel labZblh = new JLabel("装备炼化");
        labZblh.setBounds(29, 85, 141, 20);
        labZblh.setForeground(color);
        labZblh.setFont(font);
        this.add(labZblh);
        JLabel labLhsb = new JLabel("炼化神兵");
        labLhsb.setBounds(29, 145, 141, 20);
        labLhsb.setForeground(color);
        labLhsb.setFont(font);
        this.add(labLhsb);

        JLabel labLhxq = new JLabel("炼化仙器");
        labLhxq.setBounds(29, 165, 141, 20);
        labLhxq.setForeground(color);
        labLhxq.setFont(font);
        this.add(labLhxq);

        JLabel labzxcz = new JLabel("造型重铸");
        labzxcz.setBounds(29, 185, 141, 20);
        labzxcz.setForeground(color);
        labzxcz.setFont(font);
        this.add(labzxcz);

        JLabel lahbsj = new JLabel("伙伴装备升级");
        lahbsj.setBounds(29, 205, 141, 20);
        lahbsj.setForeground(color);
        lahbsj.setFont(font);
        this.add(lahbsj);

        JLabel lahbcz = new JLabel("伙伴装备重铸");
        lahbcz.setBounds(29, 225, 141, 20);
        lahbcz.setForeground(color);
        lahbcz.setFont(font);
        this.add(lahbcz);

        JLabel lahbpy = new JLabel("伙伴装备培养");
        lahbpy.setBounds(29, 245, 141, 20);
        lahbpy.setForeground(color);
        lahbpy.setFont(font);
        this.add(lahbpy);

        labZbwz.addMouseListener(new MouseAdapter(){

            @Override
            public void mousePressed(final MouseEvent e){
                labZbwz.setOpaque(true);
                labZbwz.setBackground(new Color(33, 42, 52));
                labZbdz.setOpaque(false);
                labZbdz.setBackground(null);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);

                RefiningEquiJpanel.this.labGoodstxt[0].setText("高级装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("对应矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("血玲珑");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("<html><body><p align= center >巫铸</p><p align= center >材料</p><p align= center >数量</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
            }*/
        });

        labZbdz.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labZbdz.setOpaque(true);
                labZbdz.setBackground(new Color(33, 42, 52));
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("对应矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });
        labZblh.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labZblh.setOpaque(true);
                labZblh.setBackground(new Color(33, 42, 52));
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("<html><body><p align= center >内丹</p><p align= center >&nbsp;</p><p align= center >精华</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("血玲珑");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("<html><body><p align= center >九彩</p><p align= center >云龙</p><p align= center >珠</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("<html><body><p align= center >九彩</p><p align= center >云龙</p><p align= center >珠</p></body></html>");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("<html><body><p align= center >九彩</p><p align= center >云龙</p><p align= center >珠</p></body></html>");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });
        labLhsb.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhsb.setOpaque(true);
                labLhsb.setBackground(new Color(33, 42, 52));
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("神兵");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("神兵石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });
        labLhxq.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setOpaque(true);
                labLhxq.setBackground(new Color(33, 42, 52));
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("仙器");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("仙器精华");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        labzxcz.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setOpaque(true);
                labzxcz.setBackground(new Color(33, 42, 52));
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("仙器");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("重铸石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        lahbsj.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setOpaque(true);
                lahbsj.setBackground(new Color(33, 42, 52));
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        lahbcz.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setOpaque(true);
                lahbcz.setBackground(new Color(33, 42, 52));
                lahbpy.setBackground(null);
                lahbpy.setOpaque(false);
                RefiningEquiJpanel.this.labGoodstxt[0].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("矿石");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        lahbpy.addMouseListener(new MouseAdapter(){
            @Override
            public void mousePressed(final MouseEvent e){
                labLhxq.setBackground(null);
                labLhxq.setOpaque(false);
                labLhsb.setBackground(null);
                labLhsb.setOpaque(false);
                labZbwz.setBackground(null);
                labZbwz.setOpaque(false);
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
                labZblh.setBackground(null);
                labZblh.setOpaque(false);
                labzxcz.setBackground(null);
                labzxcz.setOpaque(false);
                lahbsj.setBackground(null);
                lahbsj.setOpaque(false);
                lahbcz.setBackground(null);
                lahbcz.setOpaque(false);
                lahbpy.setOpaque(true);
                lahbpy.setBackground(new Color(33, 42, 52));
                RefiningEquiJpanel.this.labGoodstxt[0].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[1].setText("伙伴装备");
                RefiningEquiJpanel.this.labGoodstxt[2].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[3].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[4].setText("--");
                RefiningEquiJpanel.this.labGoodstxt[5].setText("--");
            }
           /* @Override
            public void mouseExited(MouseEvent e) {
                // TODO Auto-generated method stub
                labZbdz.setBackground(null);
                labZbdz.setOpaque(false);
            }*/
        });

        int i = 0;
        while (i < 6) {
            final int row = i % 3;
            final int col = i / 3;
            (this.labGoodstxt[i] = new JLabel("", 0)).setBounds(227 + row * 67, 100 + col * 65, 54, 51);
            this.labGoodstxt[i].setForeground(new Color(102, 102, 102));
            this.labGoodstxt[i].setFont(new Font("宋体", 0, 13));
            this.add((Component)this.labGoodstxt[i]);
            ++i;
        }

    }


    /** 点击good */
    public void ClickGood(Goodstable good, int path) {
        if (path < 24) {
            boolean a = true;
            //世间尘 810 九幽魄 812 云织锦 813 吼山石 811 龙漓珠814  金刚丝815
            //级武器 800 帽子 600 601
            if (good != null && (good.getType() >= 497 && good.getType() <= 499) && (good.getType()>=810 && good.getType()<=815)) {
                int i = 1;
                if (good.getType() == 497) {
                    i = 1;
                } else if (good.getType() == 499) {
                    i = 2;
                }else if (good.getType() == 498 || (good.getType()>=810 && good.getType()<=815)) {
                    i = 3;
                }
                if (goods[i] == null) {
                    change(good, i);
                    a = false;
                } else if (!goods[i].getType().equals(good.getType())) {
                    change(good, i);
                    a = false;
                }
            }
            if (a) {
                for (int i = 0; i < goods.length; i++) {
                    if (goods[i] == null) {
                        change(good, i);
                        break;
                    }
                }
            }
        } else {
            change(null, path - 24);
        }
        String v = RefiningUtil.detection(goods, type);
        if (!workshopBtn.getText().equals(v)) {
            workshopBtn.setText(v);
        }
    }

    /** 切换指定位置 */
    public void change(Goodstable good, int path) {
        goods[path] = good;
        if (good != null) {
            labGoods[path].setIcon(GoodsListFromServerUntil.imgpathAdaptive(good.getSkin(),49,49));
        } else {
            labGoods[path].setIcon(null);
        }
    }
    /**重置物品*/
    public void ResetGood(Goodstable good) {
    	for (int i = 0; i < goods.length; i++) {
			if (goods[i]!=null&&goods[i].getRgid().compareTo(good.getRgid())==0) {
				if (good.getUsetime()<=0) {
					goods[i]=null;
					labGoods[i].setIcon(null);
				}else {
					goods[i]=good;
					labGoods[i].setIcon(GoodsListFromServerUntil.imgpathAdaptive(good.getSkin(),49,49));					
				}
				String v = RefiningUtil.detection(goods, type);
		        if (!workshopBtn.getText().equals(v)) {
		            workshopBtn.setText(v);
		        }
				break;
			}
		}
    }
    /** 1炼化装备 2炼化配饰 */
    private int type = 1;

    /** 切换界面 */
    public void changeFrom(int type) {
        if (this.type == type) {
            return;
        }
        for (int i = 0; i < goods.length; i++) {
            change(null, i);
        }
        this.type = type;
        this.icon2 = null;
    }

    private ImageIcon icon;
    private ImageIcon icon2;

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if("水墨UI".equals(MyIsif.getStyle())) {
            if (icon == null) {
                icon = CutButtonImage.getImage("inkImg/newbackground/B238.png", -1, -1);
            }
            if (icon2 == null) {
                icon2 = new ImageIcon("inkImg/newbackground/B247.png");
            }
            // 背景
            g.drawImage(icon.getImage(), 0, 0, this);
            g.drawImage(icon2.getImage(), 214, 55, this);
            // 画物品的图片和数量
            GoodsListFromServerUntil.draw(g, 218, 287);
            // 画现金
            Util.drawMoney(g, 322, 231);
            // 画消耗金钱
            if (money != null) {
                Util.drawPrice(g, money, 322, 258);
            }
        }else{
            if (this.icon == null) {
                this.icon = new ImageIcon("inkImg/hongmu/2/workshop_refine.png");
            }
            g.drawImage(this.icon.getImage(), 0, 61, this);
            GoodsListFromServerUntil.draw(g, 193, 298);
            Util.drawMoney(g, 297, 242);
            Util.drawMoneyS(g, 87, 325);
            if (this.money != null) {
                Util.drawPrice(g, this.money, 297, 269);
            }
        }

    }

    public JLabel[] getGoodsListLabel() {
        return GoodsListLabel;
    }

    public void setGoodsListLabel(JLabel[] goodsListLabel) {
        GoodsListLabel = goodsListLabel;
    }

    public goodbtn[] getBtnrights() {
        return btnrights;
    }

    public void setBtnrights(goodbtn[] btnrights) {
        this.btnrights = btnrights;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }
    public Goodstable[] getGoods() {
        return goods;
    }

    public void setGoods(Goodstable[] goods) {
        this.goods = goods;
    }
    public RefineOperBtn getWorkshopBtn() {
        return workshopBtn;
    }

    public void setWorkshopBtn(RefineOperBtn workshopBtn) {
        this.workshopBtn = workshopBtn;
    }
    public JLabel[] getLabGoods() {
        return labGoods;
    }

    public void setLabGoods(JLabel[] labGoods) {
        this.labGoods = labGoods;
    }
}
